package mc

import (
	"gitee.com/dreamwood/ez-go/db/mgo"
)

const (
	SellOrderStatusEventNew           = "erp.SellOrderStatusNew"
	SellOrderStatusEventBeforeCreate  = "erp.SellOrderStatusBeforeCreate"
	SellOrderStatusEventBeforeUpdate  = "erp.SellOrderStatusBeforeUpdate"
	SellOrderStatusEventBeforeSave    = "erp.SellOrderStatusBeforeCreate erp.SellOrderStatusBeforeUpdate"
	SellOrderStatusEventAfterCreate   = "erp.SellOrderStatusAfterCreate"
	SellOrderStatusEventAfterUpdate   = "erp.SellOrderStatusAfterUpdate"
	SellOrderStatusEventAfterSave     = "erp.SellOrderStatusAfterCreate erp.SellOrderStatusAfterUpdate"
	SellOrderStatusEventDelete        = "erp.SellOrderStatusDelete"
	SellOrderStatusAccessControlEvent = "erp.SellOrderStatusAccessControl"
)

func GetSellOrderStatusConfig() *mgo.DocConfig {
	return SellOrderStatus_Config
}

var SellOrderStatus_Config *mgo.DocConfig

func init() {
	SellOrderStatus_Config = NewSellOrderStatusConfig()
}
func NewSellOrderStatusConfig() *mgo.DocConfig {
	return &mgo.DocConfig{
		ContainerKey: "erp.SellOrderStatus",
		Fields: []string{
			"name", "sort", "l", "r", "level", "link", "parent", "children", "color", "background", "group", "step", "warn",
		},
		RelationFields: []string{
			"parent", "children",
		},
		RelationConfigs: map[string]*mgo.DocRelation{
			"parent": {
				Config:     GetSellOrderStatusConfig,
				DocName:    "SellOrderStatus",
				JoinType:   "O",
				KeyInside:  "parentId",
				KeyOutSide: "id",
			},
			"children": {
				Config:     GetSellOrderStatusConfig,
				DocName:    "SellOrderStatus",
				JoinType:   "M",
				KeyInside:  "id",
				KeyOutSide: "parentId",
			},
		},
		FieldFilter: map[string]*mgo.DocFieldFilter{
			"default": {
				Select: []string{},
				Omit:   []string{},
			},
		},
	}
}
